import os
import  subprocess
def read_first_128_bits_as_hex(file_path):
    with open(file_path, 'rb') as f:
        first_16_bytes = f.read(16)  # 128 位 = 16 字节
    hex_str = first_16_bytes.hex()
    return hex_str

def work():
    base_dir = os.path.dirname(os.path.abspath(__file__)) + "/../../"
    input_file_path = base_dir + "data/server/result/result_en.txt"
    output_file_path = base_dir + "data/server/result/result.txt"
    hex_str = read_first_128_bits_as_hex(base_dir+"data/server/p.bin")
    exec_path = base_dir + "bin/crypto.exe"
    result = subprocess.run([exec_path,input_file_path,output_file_path, hex_str])


if __name__ == '__main__':
    work()